package de.bazinga.rotw.collision;

import java.util.Hashtable;
import java.util.Vector;

import com.jme.scene.Spatial;

public class CollidableObjects {
	private Hashtable<String,Vector<Spatial>> objects = new Hashtable<String,Vector<Spatial>>();
	
	private static CollidableObjects instance = null;
	
	private CollidableObjects() {
		
	}
	
	public static CollidableObjects getInstance() {
		if(instance == null) instance = new CollidableObjects();
		return instance;
	}
	
	public void addObject(String type, Spatial object) {
		if(!objects.containsKey(type)) {
			objects.put(type, new Vector<Spatial>());
		}
		objects.get(type).add(object);
	}
	
	public Vector<Spatial> getObjects(String type) {
		if(objects.containsKey(type)) {
			return objects.get(type);
		}
		objects.put(type, new Vector<Spatial>());
		
		return objects.get(type);
	}
	
	public void clear() {
		objects.clear();
	}
}
